/*
 * app_cli_type.h
 *
 *  Created on: 2023年6月29日
 *      Author: HXF
 */

#ifndef APP_CLI_CONFIG_H_
#define APP_CLI_CONFIG_H_

#include <stdint.h>
#include <stdbool.h>
#include <string.h>

#define DS_CLI_INPUT_BUFFER_SIZE        (128)
#define DS_CLI_MAX_INPUT_ARGUMENTS      (16)

#define DS_STATUS_HAS_OVERFLOWED      (0x001E)  //Item/list/queue has been overflowed
#define DS_STATUS_INVALID_PARAMETER   (0x0021)  //Generic invalid argument or consequence of invalid argument.
#define DS_STATUS_INVALID_TYPE        (0x0026)  //Invalid type for operation.
#define DS_STATUS_INVALID_COUNT       (0x002B)  //Invalid count.
#define DS_STATUS_NOT_FOUND           (0x002D)  //Item could not be found.
#define DS_STATUS_CLI_NO_DO           (0x002E)

typedef uint8_t ds_cli_argument_type_t;

typedef struct {
  struct ds_cli *handle;                        // The current cli handle.
  int argc;                                     // The total number of input strings (command group names, if any + command + corresponding arguments).
  void **argv;                                  // A pointer to the input string array.
  int arg_ofs;                                  // The offset in the input string array where the arguments start (after the command group names, if any and command).
  const ds_cli_argument_type_t* arg_type_list;  //List of argument types
} ds_cli_command_arg_t;

typedef void (*ds_cli_command_func_t)(ds_cli_command_arg_t *arguments);
typedef void (*ds_cli_command_function_t)(char *arg_str, void *user);

typedef struct {
  ds_cli_command_func_t function;             // Command function
  ds_cli_argument_type_t arg_type_list[];     // List of argument types
} ds_cli_command_info_t;

typedef struct {
  const char                  *name;        // String associated with command
  const ds_cli_command_info_t *command;     // Pointer to command information
  const char                  *description;
} ds_cli_command_entry_t;

typedef struct ds_cli{
  char input_buffer[DS_CLI_INPUT_BUFFER_SIZE];  //The input buffer
  int input_size;                               //Length of input buffer
  const ds_cli_command_entry_t *command_table;  // Command table pointer.
}ds_cli_t;

typedef ds_cli_t *ds_cli_handle_t;

//test 产测指令枚举
typedef enum
{
  TEST_RFM_CMD_START = 0x00,
  TEST_RFM_CMD_FACTORY,
  TEST_RFM_CMD_TH_DISPLAY_ALL_ON,     // 测试温湿度计：全屏显示
  TEST_RFM_CMD_TH_DISPLAY_ALL_OFF,    // 测试温湿度计：全屏熄灭
  TEST_RFM_CMD_TH_DISPLAY_ALL_EXIT,   // 测试温湿度计：退出全屏显示
  TEST_RFM_CMD_PL_RESET_CAL,          // 清除强电设备校校准参数
  TEST_RFM_CMD_CFG_868M,              // 配置868M频段
  TEST_RFM_CMD_CFG_915M,              // 配置915M频段
  TEST_RFM_CMD_CFG_433M,              // 配置433M频段
  TEST_RFM_CMD_CFG_915M_RCM,          // 配置915MRCM认证频段
  TEST_RFM_CMD_CFG_868M_WPC,          // 配置868MWPC认证频段
  TEST_RFM_CMD_STOP
}TEST_RFM_CMD_E;


#endif /* APP_CLI_CONFIG_H_ */
